<?php


Route::group(['middleware' => 'web', 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    Auth::routes();
});


Route::group(['middleware' => ['web','auth:admin'], 'prefix' => 'admin', 'namespace' => 'Modules\Admin\Http\Controllers'], function()
{
    Route::resource('/','ShouyeController');

    Route::resource('/admin', 'AdminController');
    //注册一个admin模块的角色管理的资源路由
    Route::resource('/role','RoleController')->middleware("permission:admin,resource");

    //注册一个加载权限模板的路由
    Route::get('/permission/{role}','RoleController@permission')->name('permission')->middleware("permission:admin");
    //注册一个处理权限操作的路由
    Route::post('/assignPermission/{role}','RoleController@assignPermission')->name('assginPermission')->middleware("permission:admin");



    //注册一个后台用户管理的资源路由
    Route::resource('/adminuser','AdminUserController')->middleware("permission:admin,resource");
    //注册一个加载为后台用户添加角色模板的路由
    Route::get('/addrole/{admin}','AdminUserController@addRole')->name('addrole')->middleware("permission:admin");
    Route::post('/postrole/{admin}','AdminUserController@postRole')->name('postrole')->middleware("permission:admin");
});
